package com.shanzmoo.core.domain.vo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shanzmoo.db.module.msys.entity.MSysRoleEntity;
import com.shanzmoo.db.module.psys.entity.PSysRoleEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 角色分页返回对象
 * @author: Gzhao 2020/11/12
 */
@Data
@ApiModel(value="RolePageVo", description="角色分页返回对象")
public class SysRolePageVO {

    @ApiModelProperty("角色ID")
    private Integer id;

    @ApiModelProperty("角色名")
    private String roleName;

    @ApiModelProperty("角色权限字符串")
    private String roleKey;

    @ApiModelProperty("状态：1-启用，2-禁用")
    private Boolean status;

    @ApiModelProperty("描述")
    private String description;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("创建时间" )
    private LocalDateTime createTime;

    @ApiModelProperty("菜单id列表")
    private List<Integer> menuIds;

    public static SysRolePageVO createP(PSysRoleEntity roleEntity) {
        return JSON.parseObject(JSON.toJSONString(roleEntity), SysRolePageVO.class);
    }

    public static SysRolePageVO createByM(MSysRoleEntity roleEntity) {
        return JSON.parseObject(JSON.toJSONString(roleEntity), SysRolePageVO.class);
    }
}
